<?php
$user_result = mysql_query("SELECT articles.id, articles.date, articles.header, users.name, articles.accepted, articles.deleted FROM articles, users WHERE articles.user=users.id AND (articles.accepted=0 OR articles.deleted=1);");
if (mysql_error())
    die(mysql_error());
?>


<p class="page-header-text">Администрирование статей</p>
<table id="articles-table">
    <tbody>
<?php

while ($row = mysql_fetch_array($user_result)) {


    if ($row['deleted'])
        $_status_ = "<span class='error'>Автор: ".$row['name'].", статья удалена</span>";
    else if ($row['accepted'])
        $_status_ = "<span class='accept'>Автор: ".$row['name'].", статья доступна</span>";
    else
        $_status_ = "<span class='waiting'>Автор: ".$row['name'].", решение не принято</span>";

    echo ('<tr>');
    echo ('<td class="td_artic_date">' . $row['date'] . '</td>');
    echo ('<td class="td_artic_header"><a href="./article.php?id=' . $row['id'] . '">' . substr($row['header'], 0, 50));
    echo ('</a> (' . $_status_ . ')</td>');
    echo ('</tr>');
}
?>
    </tbody>
</table>